package com.shxc.smarttrade.old.adapternew;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.shxc.smarttrade.R;
import com.shxc.smarttrade.old.bean.HomePagerDatas;
import com.shxc.smarttrade.old.myinterface.MasterItemClickListener;
import com.zhy.autolayout.utils.AutoUtils;

import java.util.List;

/**
 * Created by jcdev1 on 2017/5/16.
 */

public class CurrentPositionAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {


    private Context mContext;
    private LayoutInflater mInflater;
    private MasterItemClickListener listener;

    public CurrentPositionAdapter(Context mContext) {
        this.mContext = mContext;
        mInflater = LayoutInflater.from(mContext);

    }

    public void setDatas(List<HomePagerDatas.DataBean.MastersBean> mastersBeen) {
        notifyDataSetChanged();
    }

    public void setMyItemCLickListener(MasterItemClickListener listener) {
        this.listener = listener;

    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

        return new QuotationHolder(mInflater.inflate(R.layout.adapter_current_position_layout, parent, false));

    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {
        if (holder instanceof QuotationHolder) {
//            Glide.with(mContext).load(mb.getHeadUrl()).into(((MasterHolder) holder).ivHead);
            holder.itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                }
            });
        } else {
            holder.itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                }
            });
        }

    }

    @Override
    public int getItemCount() {
        return 5;
    }


    public class QuotationHolder extends RecyclerView.ViewHolder {

//        @Bind(R.id.tv_name)
//        CustomTextView tvName;
//        @Bind(R.id.tv_en_name)
//        CustomTextView tvEnName;
//        @Bind(R.id.iv_profit_status)
//        ImageView ivProfitStatus;
//        @Bind(R.id.tv_open_price)
//        TextView tvOpenPrice;
//        @Bind(R.id.tv_current_price)
//        TextView tvCurrentPrice;
//        @Bind(R.id.tv_float_profit)
//        TextView tvFloatProfit;
//        @Bind(R.id.tv_hands)
//        TextView tvHands;
//        @Bind(R.id.ll_close_position)
//        AutoLinearLayout llClosePosition;

        QuotationHolder(View view) {
            super(view);
//            ButterKnife.bind(this, view);
            AutoUtils.autoSize(view);
        }
    }

}
